﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using hospital_registration_system.DAL;
using hospital_registration_system.Entity;

namespace hospital_registration_system.BLL
{
    /// <summary>
    /// 就诊记录表服务
    /// </summary>
    public class Medical_recordService
    {
        protected Medical_recordDao dao = null;

        public Medical_recordService()
        {
            dao = new Medical_recordDao();
        }

        /// <summary>
        /// 查询所有的就诊记录
        /// </summary>
        /// <returns></returns>
        public List<Medical_record> selectAllMedical_record()
        {
            return dao.selectAll();
        }

        /// <summary>
        /// 删除指定id的记录
        /// </summary>
        /// <param name="recordId">记录id</param>
        /// <returns>是否成功</returns>
        public bool deleteMedical_record(int recordId)
        {
            return dao.delete(recordId);
        }

        /// <summary>
        /// 通过患者id查询患者的就诊记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Medical_record> selectMedicalRecordByPId(int id)
        {
            Dictionary<string, object> map = new Dictionary<string, object>();
            map.Add("patient_id", id);//注入要查询的字段
            return dao.selectByMap(map);
        }
    }
}
